from models import db
from datetime import datetime


class Books(db.Model):
    __tablename__ = 'tb_book'

    bid = db.Column(db.Integer, primary_key=True, autoincrement=True)
    book_name = db.Column(db.String(100), doc='书名')
    book_auther = db.Column(db.Integer, db.ForeignKey("tb_auther.aid"), primary_key=True)
    book_publicate_time = db.Column(db.DateTime, default=datetime.now(), doc='创作时间')
    book_price = db.Column(db.String(5), doc='书的价格')


class Authers(db.Model):
    __tablename__ = 'tb_auther'

    aid = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(100), doc='作者名')
    age = db.Column(db.Integer, doc='年龄')
    gender = db.Column(db.Integer, default=1, doc='0女，1男')
    pen_name = db.Column(db.String(100), doc='作者的笔名')


